export const GetSession = (name) => {
  return JSON.parse(sessionStorage.getItem(name))
}

export const SetSession = (name, data) => {
  if (typeof data !== "object") {
    sessionStorage.setItem(name, data)
  } else {
    sessionStorage.setItem(name, JSON.stringify(data))
  }
}

export const RemoveSession = (name) => {
  if (typeof data !== "object") {
    sessionStorage.removeItem(name, data)
  } else {
    sessionStorage.removeItem(name, JSON.stringify(data))
  }
}

export const GetLocal = (name) => {
  return JSON.parse(localStorage.getItem(name))
}

export const SetLocal = (name, data) => {
  if (typeof data !== "object") {
    localStorage.setItem(name, data)
  } else {
    localStorage.setItem(name, JSON.stringify(data))
  }
}

export const RemoveLocal = (name, data) => {
  if (typeof data !== "object") {
    localStorage.removeItem(name, data)
  } else {
    localStorage.removeItem(name, JSON.stringify(data))
  }
}